﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace EasyInvoice.Services
{
    public class InvoicesService
    {
        EasyInvoice.SqlCEDAL.IInvoices dal;

        public InvoicesService(EasyInvoice.SqlCEDAL.IInvoices dal)
        {
            if (dal == null)
            {
                throw new ArgumentNullException("dal");
            }
            this.dal = dal;
        }

        public long Save(Model.Invoice invoice)
        {
            return dal.Save(invoice);
        }

        public Model.Invoice Delete(Model.Invoice invoice)
        {
            return dal.Delete(invoice);
        }

        public Model.Invoice Get(long id)
        {
            return dal.GetById(id);
        }

        public IEnumerable<Model.Invoice> GetAll()
        {
            return dal.GetAll();
        }
    }
}
